﻿using DataTurnClient.Server;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace DataTurnClient.Model
{
    public class TaskRequest
    {
        public List<Job> job { get; set; }

        public List<RouteLine> setList { get; set; }

        public string jobs { get; set; }

        public Result<string> msg { get; set; }

        public Result<string> SomeSyncAsync()
        {
            Result<string> msg = new Result<string>();
            msg = HttpService.Execute(job, setList, jobs);
            return msg;
        }
        public static string Url(Job jobs)
        {
            string route = jobs.JobRoute.Split(':')[1];
            if (route != "") { route = route + "/"; }
            int line = Convert.ToInt32(jobs.JobRoute.Split(':')[0]);
            RouteLine session = Globals.RouteList.Where(x => x.Id == line).FirstOrDefault();
            return $"http://{session.Ip}:{session.Port}/{session.Path}/{route}{jobs.JobCode}";
        }
    }
}
